//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef DM9000_VAR_H_
#define DM9000_VAR_H_



typedef struct
{
    UInt8 keyState;
    UInt8 noUse11;
    UInt8 noUse12;
    UInt8 noUse13;

    UInt8 intState;
    UInt8 noUse21;
    UInt8 noUse22;
    UInt8 noUse23;

    UInt8 intMask;
    UInt8 noUse31;
    UInt8 noUse32;
    UInt8 noUse33;

    UInt8 pwrIO;
    UInt8 noUse41;
    UInt8 noUse42;
    UInt8 noUse43;

    UInt8 extIO;
} CPLDREGS;

//#define CPLD ((CPLDREGS *)(0x90000000))
//#define BASEADDR 0x91000000

extern unsigned int address1, address2;
#define CPLD ((CPLDREGS *)address1)
#define BASEADDR address2

#define ETH_INT_MASK  (1<<6)
#define ETH_RST 1<<2
#define ETH_PWR 1<<6


EXTERN_C void dump_buf(Byte *buf, int len, char *disc, int dump);
EXTERN_C ECode DeviceThread(void *arg);

void CPLD_SetPwrIO( UInt32 pwrNum, UInt32 state );
void CPLD_SetExtIO( UInt32 extNum, UInt32 state );
void CPLD_SetIntMask( UInt32 intNum, UInt32 state );
void CPLD_Init();
int dm9000_connect(void * softc, void** hardc);
EXTERN_C Boolean __stdcall dm9000new();


#define DRVINITALIZE    0x00000001
#define ENABLEIRQ       0x00000002
#define DISABLEIRQ      0x00000003
#define DRVSHUTDOWN     0x00000004

class Node : public DLinkNode
{
public:
    Node(unsigned long * p, int len);
    Node(){}
    void InsertNode(Node *p);
    Node * GetNode();

    unsigned long *m_address;
    int m_len;
};


#endif //DM9000_VAR_H
